home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / qbasix.zip / QBASIX.BAS < prev    next >
BASIC Source File  |  1994-05-08  |  3KB  |  107 lines

  1. '******************************************************************************
  2. '*            QBASIX - assembler routines for QBASIC - version 2              *
  3. '*                      BASIC shell for using QBASIX                          *
  4. '*                       (c) Hans Lunsing - 04/1993                           *
  5. '******************************************************************************
  6.  
  7. 'This file contains the BASIC shell which is necessary for using QBASIX
  8. 'in your own programs. The only things the shell does are checking if
  9. 'QBASIX is loaded and establishing its segment and offset. To save
  10. 'memory space the QBASIX routines are included in a separate file named
  11. 'QBASIX.PRO, from which you only need to copy the routines you really
  12. 'want to use. Don't forget to copy the routines which are called by them
  13. 'and the declarations going with them also.
  14.  
  15. 'It is possible to use QBASIX with QuickBasic versions 4.0 and 4.5.
  16. 'In that case load the program with QB QBASIX /L QBABS.
  17.  
  18. 'When you use this file as a start for your program you can of course
  19. 'remove this comment.
  20.  
  21. DEFINT A-Z
  22.  
  23. ' Numbers of the assembler routines in QBasix:
  24.  
  25. CONST cBlinkStatus = 0
  26. CONST cFillWindow = 1
  27. CONST cGetActiveColor = 2
  28. CONST cGetVideoInfo = 3
  29. CONST cMsDOS = 4
  30. CONST cInterruptX = 5
  31. CONST cLptReady = 6
  32. CONST cMemCopy = 7
  33. CONST cMemScan = 8
  34. CONST cSaveWindow = 9
  35. CONST cRestoreWindow = 10
  36. CONST cSetError = 11
  37. CONST cShift = 12
  38. CONST cToggleBlinkBit = 13
  39. CONST cCmd = 14
  40. CONST cSetCmd = 15
  41.  
  42. ' Logical constants:
  43.  
  44. CONST TRUE = -1, FALSE = 0
  45.  
  46. ' Declarations of procedures
  47.  
  48. DECLARE FUNCTION IsQBasix ()
  49. DECLARE SUB PrintError (ErrCode)
  50.  
  51. '*****************************************************************************
  52.  
  53. ' Room for more declarations
  54.  
  55. '*****************************************************************************
  56.  
  57. IF NOT IsQBasix THEN
  58.   PrintError 110
  59.   PRINT
  60.   PRINT "---> Unfortunately, the program has to be stopped."
  61. ELSE
  62.  
  63. '*****************************************************************************
  64.  
  65. ' Room for the program
  66.  
  67. '*****************************************************************************
  68.  
  69. END IF
  70. '*****************************************************************************
  71. ' When your program once is running well the END command can be replaced
  72. ' by SYSTEM. In that case QBASIC returns to DOS immediately after the
  73. ' program ends.
  74. '*****************************************************************************
  75. END
  76.  
  77. '*****************************************************************************
  78.  
  79. ' Room for more subroutines and functions.
  80.  
  81. '*****************************************************************************
  82.  
  83. FUNCTION IsQBasix ()
  84.   '***
  85.   '*** Assembler routine to ascertain that QBasix is loaded and to get
  86.   '*** its segment and offset:
  87.   CONST IsQBasixASM = "Uï∞3╔╕╛δ═/<δuï^ëï^ë]╩"
  88.   '*** N.B.: Do not change this constant !!!
  89.   '***
  90.   SHARED SegBasix, OffsBasix
  91.   Temp$ = IsQBasixASM + CHR$(0)
  92.   DEF SEG = VARSEG(Temp$)
  93.   CALL ABSOLUTE(SegBasix, OffsBasix, SADD(Temp$))
  94.   IsQBasix = (SegBasix <> 0)
  95. END FUNCTION
  96.  
  97. SUB PrintError (ErrCode)
  98.   'You can extend this routine with more error messages
  99.   SELECT CASE ErrCode
  100.     CASE 110
  101.        PRINT "QBASIX is not loaded."
  102.        PRINT "QBASIX has to be loaded before QBASIC by giving the command"
  103.        PRINT "QBASIX or - in DOS 5 and higher only - QBASIX /H."
  104.   END SELECT
  105. END SUB
  106.  
  107.